-ifndef(__LOG_H__).
-define(__LOG_H__, true).
-ifdef(debug_test).

-define(INFO(Format, Args), io:format("[INFO] {~p} ~p:~p/~p[~w] "++Format++"~n", [case erlang:process_info(self(), registered_name) of
                                                                                        {registered_name, Name} -> Name;
                                                                                        _ -> self()
                                                                                      end, ?MODULE, ?FUNCTION_NAME, ?FUNCTION_ARITY, ?LINE]++Args)).
-define(WARNING(Format, Args), io:format("[WARNING] {~p} ~p:~p/~p[~w] "++Format++"~n", [case erlang:process_info(self(), registered_name) of
                                                                                              {registered_name, Name} -> Name;
                                                                                              _ -> self()
                                                                                            end, ?MODULE, ?FUNCTION_NAME, ?FUNCTION_ARITY, ?LINE]++Args)).
-define(ERR(Format, Args), io:format("[ERROR] {~p} ~p:~p/~p[~w] "++Format++"~n", [case erlang:process_info(self(), registered_name) of
                                                                                        {registered_name, Name} -> Name;
                                                                                        _ -> self()
                                                                                      end, ?MODULE, ?FUNCTION_NAME, ?FUNCTION_ARITY, ?LINE]++Args)).
-else.
  -define(INFO(Format, Args), lager:info("{~p} ~p:~p/~p[~w] "++Format++"~n", [case erlang:process_info(self(), registered_name) of
                                                                              {registered_name, Name} -> Name;
                                                                              _ -> self()
                                                                            end, ?MODULE, ?FUNCTION_NAME, ?FUNCTION_ARITY, ?LINE]++Args)).
  -define(WARNING(Format, Args), lager:warning("{~p} ~p:~p/~p[~w] "++Format++"~n", [case erlang:process_info(self(), registered_name) of
                                                                                 {registered_name, Name} -> Name;
                                                                                 _ -> self()
                                                                               end, ?MODULE, ?FUNCTION_NAME, ?FUNCTION_ARITY, ?LINE]++Args)).
  -define(ERR(Format, Args), lager:error("{~p} ~p:~p/~p[~w] "++Format++"~n", [case erlang:process_info(self(), registered_name) of
                                                                                    {registered_name, Name} -> Name;
                                                                                    _ -> self()
                                                                                  end, ?MODULE, ?FUNCTION_NAME, ?FUNCTION_ARITY, ?LINE]++Args)).

-endif.
-endif.